package org.travel.app.controller;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;
import org.travel.app.common.vo.ResultVO;
import org.travel.app.entity.user.User;
import org.travel.app.entity.ticket.TicketOrderMsg;
import org.travel.app.service.impl.OrderServiceImpl;
import org.travel.app.service.impl.ReservationImpl;

/**
 * @author nmm
 * @date 2024-12-2024/12/25
 * @deriction njm......
 */
@RestController
@RequestMapping("/order")
@RequiredArgsConstructor
public class OrderController extends BaseController{
private  final OrderServiceImpl orderService;
private final ReservationImpl reservationService;
private final RedisTemplate<String,Object> redisTemplate;

@PostMapping("/getOrderList")
public ResultVO getOrderList(@RequestBody User user) {
	return success(orderService.getOrderList(user.getUserId()));
}

@PostMapping("/getOrderDetail")
public ResultVO getOrderDetail(@RequestBody TicketOrderMsg orderMsg) {
	return success(reservationService.getSpotsReservationByOrderId(orderMsg.getOrderId()));
}

@GetMapping("/TestPayPort")
public String TestPayPort() {
	return "Success";
}

@GetMapping("/getCurrentOrderStatus")
public ResultVO getCurrentOrderStatus() {
	return success(redisTemplate.opsForValue().get("orderCurrentStats"));
}


}